/**
 * Created by fei-zyx on 2017/2/20.
 */
function makeSQL() {


    var sql = "select picname";

    /*if (document.getElementById("FileName").checked == true)
     sql = sql + " ,File_Name ";*/
    //if (document.getElementById("taskId").checked == true)
        sql = sql + ",TASK_ID";
    //if (document.getElementById("DM").checked == true)
        sql = sql + ",file_id,dm,cand,cut_id";
    //if (document.getElementById("Ptopo").checked == true)
        sql = sql + ",PTOPO";
    if (document.getElementById("Pbary").checked == true)
        sql = sql + ",PBARY";
    /*if (document.getElementById("Flag1").checked == true)
     sql = sql + ",FLAG1";
     if (document.getElementById("Flag2").checked == true)
     sql = sql + ",FLAG2";*/
    if (document.getElementById("Score").checked == true)
        sql = sql + ",FLAG3";
    if (document.getElementById("pic1Mark").checked == true)
        sql = sql + ",PIC_1_MARK";

    if (document.getElementById("pic1Peak").checked == true)
        sql = sql + ",PIC_1_PEAK";


    if (document.getElementById("pic1Error").checked == true)
        sql = sql + ",PIC_1_ERROR";
    if (document.getElementById("pic1Width10").checked == true)
        sql = sql + ",PIC_1_PW10";
    if (document.getElementById("pic1Width50").checked == true)
        sql = sql + ",PIC_1_PW50";

    if (document.getElementById("pic1Peaknum").checked == true)
        sql = sql + ",PIC_1_PEAKNUM";
    if (document.getElementById("pic2X").checked == true)
        sql = sql + ",PIC_2_X";
    if (document.getElementById("pic2Y").checked == true)
        sql = sql + ",PIC_2_Y";
    if (document.getElementById("pic2Percent").checked == true)
        sql = sql + ",PIC_2_PERCENT";
    if (document.getElementById("pic2Ave").checked == true)
        sql = sql + ",PIC_2_AVE";
    if (document.getElementById("pic2Avearea").checked == true)
        sql = sql + ",PIC_2_AVEAREA";
    if (document.getElementById("pic2Linenum").checked == true)
        sql = sql + ",PIC_2_LINENUM";
    if (document.getElementById("pic2Theta").checked == true)
        sql = sql + ",PIC_2_THETA";
    if (document.getElementById("pic2Rho").checked == true)
        sql = sql + ",PIC_2_RHO";
    if (document.getElementById("pic3X").checked == true)
        sql = sql + ",PIC_3_X";
    if (document.getElementById("pic3Y").checked == true)
        sql = sql + ",PIC_3_Y";
    if (document.getElementById("pic3Percent").checked == true)
        sql = sql + ",PIC_3_PERCENT";
    if (document.getElementById("pic3Ave").checked == true)
        sql = sql + ",PIC_3_AVE";
    if (document.getElementById("pic3Avearea").checked == true)
        sql = sql + ",PIC_3_AVEAREA";
    if (document.getElementById("pic3Linenum").checked == true)
        sql = sql + ",PIC_3_LINENUM";
    if (document.getElementById("pic3Theta").checked == true)
        sql = sql + ",PIC_3_THETA";
    if (document.getElementById("pic3Rho").checked == true)
        sql = sql + ",PIC_3_RHO";
    if (document.getElementById("pic4Haslorentz").checked == true)
        sql = sql + ",PIC_4_HASLORENTZ";
    if (document.getElementById("pic4Peaknum").checked == true)
        sql = sql + ",PIC_4_PEAKNUM";
    if (document.getElementById("pic4Lorentzx").checked == true)
        sql = sql + ",PIC_4_LORENTZX";
    if (document.getElementById("pic4Lorentzeheight").checked == true)
        sql = sql + ",PIC_4_LORENTZEHEIGHT";
    if (document.getElementById("vatdm0").checked == true)
        sql = sql + ",VATDM0";
    if (document.getElementById("maxv").checked == true)
        sql = sql + ",MAXV";
    if (document.getElementById("maxvatdm").checked == true)
        sql = sql + ",MAXVATDM";

    sql = sql + ",MATCH_CHECKED,IS_PULSAR,NOTES from t_pic_info where 1=1";


    if (document.getElementById("NameC").value != "")
        sql = sql + " AND File_Name=" + "'" + document.getElementById("NameC").value + "'";
    if (document.getElementById("taskIdC").value != "")
        sql = sql + " and TASK_ID=" + document.getElementById("taskIdC").value;
    if (document.getElementById("DMC1").value != "" && document.getElementById("DMC2").value != "")
        sql = sql + " and PICDM BETWEEN " + document.getElementById("DMC1").value + " AND " + document.getElementById("DMC2").value;

    if (document.getElementById("PtopoC1").value != "" && document.getElementById("PtopoC2").value != "")
        sql = sql + " and PTOPO BETWEEN " + document.getElementById("PtopoC1").value + " AND " + document.getElementById("PtopoC2").value;

    if (document.getElementById("PbaryC1").value != "" && document.getElementById("PbaryC2").value != "")
        sql = sql + " and Pbary BETWEEN " + document.getElementById("PbaryC1").value + " AND " + document.getElementById("PbaryC2").value;
    /*if (document.getElementById("Flag1C1").value != ""&&document.getElementById("Flag1C2").value != "")
     sql = sql + "and PICDM BETWEEN "+document.getElementById("Flag1C1").value +" AND "+document.getElementById("Flag1C2").value ;
     if (document.getElementById("Flag2C1").value != ""&&document.getElementById("Flag2C2").value != "")
     sql = sql + "and PICDM BETWEEN "+document.getElementById("Flag2C1").value +" AND "+document.getElementById("Flag2C2").value ;
     */
    if (document.getElementById("ScoreC1").value != "" && document.getElementById("ScoreC2").value != "")
        sql = sql + " and SCORE BETWEEN " + document.getElementById("ScoreC1").value + " AND " + document.getElementById("ScoreC2").value;
    if (document.getElementById("pic1MarkC1").value != "" && document.getElementById("pic1MarkC2").value != "")
        sql = sql + " and PIC_1_MARK BETWEEN " + document.getElementById("pic1MarkC1").value + " AND " + document.getElementById("pic1MarkC2").value;

    if (document.getElementById("pic1PeakC1").value != "" && document.getElementById("pic1PeakC2").value != "")
        sql = sql + " and PIC_1_PEAKNUM BETWEEN " + document.getElementById("pic1PeakC1").value + " AND " + document.getElementById("pic1PeakC2").value;


    if (document.getElementById("pic1ErrorC1").value != "" && document.getElementById("pic1ErrorC2").value != "")
        sql = sql + " and PIC_1_ERROR BETWEEN " + document.getElementById("pic1ErrorC1").value + " AND " + document.getElementById("pic1ErrorC2").value;
    if (document.getElementById("pic1Width10C1").value != "" && document.getElementById("pic1Width10C2").value != "")
        sql = sql + " and PIC_1_PW10 BETWEEN " + document.getElementById("pic1Width10C1").value + " AND " + document.getElementById("pic1Width10C2").value;
    if (document.getElementById("pic1Width50C1").value != "" && document.getElementById("pic1Width50C2").value != "")
        sql = sql + " and PIC_1_PW50 BETWEEN " + document.getElementById("pic1Width50C1").value + " AND " + document.getElementById("pic1Width50C2").value;

    if (document.getElementById("pic1PeaknumC1").value != "" && document.getElementById("pic1PeaknumC2").value != "")
        sql = sql + " and PIC_1_PEAKNUM BETWEEN " + document.getElementById("pic1PeaknumC1").value + " AND " + document.getElementById("pic1PeaknumC2").value;
    if (document.getElementById("pic2XC1").value != "" && document.getElementById("pic2XC2").value != "")
        sql = sql + " And PIC_2_X BETWEEN " + document.getElementById("pic2XC1").value + " AND " + document.getElementById("pic2XC2").value;
    if (document.getElementById("pic2YC1").value != "" && document.getElementById("pic2YC2").value != "")
        sql = sql + " and PIC_2_Y BETWEEN " + document.getElementById("pic2YC1").value + " AND " + document.getElementById("pic2YC2").value;
    if (document.getElementById("pic2PercentC1").value != "" && document.getElementById("pic2PercentC2").value != "")
        sql = sql + " and PIC_2_PERCENT BETWEEN " + document.getElementById("pic2PercentC1").value + " AND " + document.getElementById("pic2PercentC2").value;
    if (document.getElementById("pic2AveC1").value != "" && document.getElementById("pic2AveC2").value != "")
        sql = sql + " and PIC_2_AVE BETWEEN " + document.getElementById("pic2AveC1").value + " AND " + document.getElementById("pic2AveC2").value;
    if (document.getElementById("pic2AveareaC1").value != "" && document.getElementById("pic2AveareaC2").value != "")
        sql = sql + " and PIC_2_AVEAREA BETWEEN " + document.getElementById("pic2AveareaC1").value + " AND " + document.getElementById("pic2AveareaC2").value;
    if (document.getElementById("pic2LinenumC1").value != "" && document.getElementById("pic2LinenumC2").value != "")
        sql = sql + " and PIC_2_LINENUM BETWEEN " + document.getElementById("pic2LinenumC1").value + " AND " + document.getElementById("pic2LinenumC2").value;
    if (document.getElementById("pic2ThetaC1").value != "" && document.getElementById("pic2ThetaC2").value != "")
        sql = sql + " and PIC_2_THETA BETWEEN " + document.getElementById("pic2ThetaC1").value + " AND " + document.getElementById("pic2ThetaC2").value;
    if (document.getElementById("pic2RhoC1").value != "" && document.getElementById("pic2RhoC2").value != "")
        sql = sql + " and PIC_2_RHO BETWEEN " + document.getElementById("pic2RhoC1").value + " AND " + document.getElementById("pic2RhoC2").value;


    if (document.getElementById("pic3XC1").value != "" && document.getElementById("pic3XC2").value != "")
        sql = sql + " and PIC_3_X BETWEEN " + document.getElementById("pic3XC1").value + " AND " + document.getElementById("pic3XC2").value;
    if (document.getElementById("pic3YC1").value != "" && document.getElementById("pic3YC2").value != "")
        sql = sql + " and PIC_3_Y BETWEEN " + document.getElementById("pic3YC1").value + " AND " + document.getElementById("pic3YC2").value;
    if (document.getElementById("pic3PercentC1").value != "" && document.getElementById("pic3PercentC2").value != "")
        sql = sql + " and PIC_3_PERCENT BETWEEN " + document.getElementById("pic3PercentC1").value + " AND " + document.getElementById("pic3PercentC2").value;
    if (document.getElementById("pic3AveC1").value != "" && document.getElementById("pic3AveC2").value != "")
        sql = sql + " and PIC_3_AVE BETWEEN " + document.getElementById("pic3AveC1").value + " AND " + document.getElementById("pic3AveC2").value;
    if (document.getElementById("pic3AveareaC1").value != "" && document.getElementById("pic3AveareaC2").value != "")
        sql = sql + " and PIC_3_AVEAREA BETWEEN " + document.getElementById("pic3AveareaC1").value + " AND " + document.getElementById("pic3AveareaC2").value;
    if (document.getElementById("pic3LinenumC1").value != "" && document.getElementById("pic3LinenumC2").value != "")
        sql = sql + " and PIC_3_LINENUM BETWEEN " + document.getElementById("pic3LinenumC1").value + " AND " + document.getElementById("pic3LinenumC2").value;
    if (document.getElementById("pic3ThetaC1").value != "" && document.getElementById("pic3ThetaC2").value != "")
        sql = sql + " and PIC_3_THETA BETWEEN " + document.getElementById("pic3ThetaC1").value + " AND " + document.getElementById("pic3ThetaC2").value;
    if (document.getElementById("pic3RhoC1").value != "" && document.getElementById("pic3RhoC2").value != "")
        sql = sql + " and PIC_3_RHO BETWEEN " + document.getElementById("pic3RhoC1").value + " AND " + document.getElementById("pic3RhoC2").value;
    if (document.getElementById("pic4HaslorentzC1").value != "" && document.getElementById("pic4HaslorentzC2").value != "")
        sql = sql + " and PIC_4_HASLORENTZ BETWEEN " + document.getElementById("pic4HaslorentzC1").value + " AND " + document.getElementById("pic4HaslorentzC2").value;
    if (document.getElementById("pic4PeaknumC1").value != "" && document.getElementById("pic4PeaknumC2").value != "")
        sql = sql + " and PIC_4_PEAKNUM BETWEEN " + document.getElementById("pic4PeaknumC1").value + " AND " + document.getElementById("pic4PeaknumC2").value;
    if (document.getElementById("pic4LorentzxC1").value != "" && document.getElementById("pic4LorentzxC2").value != "")
        sql = sql + " and PIC_4_LORENTZX BETWEEN " + document.getElementById("pic4LorentzxC1").value + " AND " + document.getElementById("pic4LorentzxC2").value;
    if (document.getElementById("pic4LorentzeheightC1").value != "" && document.getElementById("pic4LorentzeheightC2").value != "")
        sql = sql + " and PIC_4_LORENTZEHEIGHT BETWEEN " + document.getElementById("pic4LorentzeheightC1").value + " AND " + document.getElementById("pic4LorentzeheightC2").value;
    if (document.getElementById("vatdm0C1").value != "" && document.getElementById("vatdm0C2").value != "")
        sql = sql + " and VATDM0 BETWEEN " + document.getElementById("vatdm0C1").value + " AND " + document.getElementById("vatdm0C2").value;
    if (document.getElementById("maxvC1").value != "" && document.getElementById("maxvC2").value != "")
        sql = sql + " and MAXV BETWEEN " + document.getElementById("maxvC1").value + " AND " + document.getElementById("maxvC2").value;
    if (document.getElementById("maxvatdmC1").value != "" && document.getElementById("maxvatdmC2").value != "")
        sql = sql + " and MAXVATDM BETWEEN " + document.getElementById("maxvatdmC1").value + " AND " + document.getElementById("maxvatdmC2").value;
    document.getElementById("queryCommandInput").value = sql;
}
$("#btntwo").hide();
$("#btnOne").bind("click", function (event) {
    $("#tab1").hide();
    $("#tab2").hide();
    $("#tab3").hide();
    $("#btngroup").hide();
    $("#btntwo").show();
    $("#btnOne").hide();
});
$("#btntwo").bind("click", function (event) {
    $("#tab1").show();
    $("#tab2").show();
    $("#tab3").show();
    $("#btngroup").show();

    $("#btnOne").show();
    $("#btntwo").hide();
});